
@extends('public.father')

@section('css')


    <link href="/templates/hd/assets/AmazeUI-2.4.2/assets/css/amazeui.css" rel="stylesheet" type="text/css"/>

    <link href="/templates/hd/assets/basic/css/demo.css" rel="stylesheet" type="text/css"/>
    <link href="/templates/hd/assets/css/cartstyle.css" rel="stylesheet" type="text/css"/>
    <link href="/templates/hd/assets/css/jsstyle.css" rel="stylesheet" type="text/css"/>

    @endsection
@section('script')

    <script type="text/javascript" src="/templates/hd/assets/js/address.js"></script>
    <script>
    $.ajaxSetup({
    headers: {
    'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
    }
    });
    </script>

@endsection
@section('content')


    <div class="concent">
        <!--地址 -->
        <div class="paycont">



            <div class="flowBox checkBox_jm" style="margin:10px auto 70px auto;border: 1px solid rgb(221, 221, 221);">
                <h6 style="text-align:center; height:30px; line-height:30px;color:#E31939;font-size: 20px;margin-top: 15px">订单提交成功！请扫描下方二维码完成支付！</h6>
                <p style="text-align:center; color:#E31939;"><span class="timespan">订单有效时间:    <span id="day_show">0天</span><strong id="hour_show">0时</strong><strong id="minute_show">0分</strong><strong id="second_show">0秒</strong></span></p>

                <table  width="99%" align="center" border="0" cellpadding="15" cellspacing="0" bgcolor="#fff" class="split_order" style="margin:20px auto;">
                    <tbody>
                    <tr>
                        <td style="padding-bottom:10px;">
                            <table width="100%" align="left" cellpadding="0" cellspacing="0" bgcolor="#fff" style="border:1px solid #eeeeee;border-bottom:none">
                                <tbody>
                                <tr>
                                    <td style="border-bottom:1px solid #eeeeee;padding-left:15px;background:#FAFAFA; width:445px;" height="30">订单号：{{$order['orderId']}}
                                    </td>
                                    <td style="border-bottom:1px solid #eeeeee;background:#FAFAFA">微信支付：¥{{$order['total']}}</td>
                                    <td style="border-bottom:1px solid #eeeeee;background:#FAFAFA">
                                        请打开微信扫描进行支付
                                    </td>
                                </tr>
                                </tbody>
                            </table>
                        </td>
                    </tr>

                    <tr id="pic">
                        <td align="center" style="padding-bottom:30px;">
                            <img style="width: 150px;" src="/weixinpay/example/qrcode.php?data=<?php echo urlencode($url);?>" style="width:150px;height:150px;">
                        </td>
                    </tr>
                    </tbody>
                </table>
                <style>
                    table.split_order tbody {
                        background: #fff
                    }

                    .submit_back a {
                        color: #F00;
                    }
                </style>
            </div>



            <!--含运费小计 -->
            <!--信息 -->
        </div>

        <div class="clear"></div>
    </div>
    <script>

        
        
        var intDiff = parseInt(1800);//倒计时总秒数量
        function timer(intDiff){
            window.setInterval(function(){
                var day=0,
                    hour=0,
                    minute=0,
                    second=0;//时间默认值
                if(intDiff > 0){
                    day = Math.floor(intDiff / (60 * 60 * 24));
                    hour = Math.floor(intDiff / (60 * 60)) - (day * 24);
                    minute = Math.floor(intDiff / 60) - (day * 24 * 60) - (hour * 60);
                    second = Math.floor(intDiff) - (day * 24 * 60 * 60) - (hour * 60 * 60) - (minute * 60);
                }
                if (minute <= 9) minute = '0' + minute;
                if (second <= 9) second = '0' + second;
                $('#day_show').html(day+"天");
                $('#hour_show').html('<s id="h"></s>'+hour+'时');
                $('#minute_show').html('<s></s>'+minute+'分');
                $('#second_show').html('<s></s>'+second+'秒');
                intDiff--;

                if (intDiff==0) {
                    // alert(123);
                    $('#pic').hide();
                    $('.timespan').html('订单已经失效')
                }

                    }, 1000);
        }
        $(function(){
            timer(intDiff);
            // alert(parseInt($('#second_show').text()))
        });


        // 发异步请求
        setInterval(function () {
            $.ajax({
                url:'/checkStatus/{{$order["orderId"]}}',
                type:'get',
                dataType:'json',
                success:function (res) {
                    //通过后台检测当前订单是否支付的返回值来判断是否要跳转去支付成功页面
                    if (res.valid){
                        location.href = '/success/{{$order['orderId']}}';
                    }
                }
            })
        },5000)

    </script>

@endsection

{{--function timer(intDiff) {--}}
{{--window.setInterval(function () {--}}
{{--let minute = 0;--}}
{{--let second = 0;//时间默认值--}}

{{--if (intDiff > 0) {--}}
{{--minute = parseInt(intDiff / 1000 / 60 % 60);--}}
{{--second = parseInt(intDiff / 1000 % 60);--}}
{{--}--}}

{{--if (minute <= 9) minute = '0' + minute;--}}
{{--if (second <= 9) second = '0' + second;--}}

{{--$('#minute_show').html('<s></s>' + minute + '分');--}}
{{--$('#second_show').html('<s></s>' + second + '秒');--}}

{{--intDiff -= 1000;--}}

{{--}, 1000);--}}

{{--}--}}

{{--$(function () {--}}
{{--let time = 1536376397 *--}}
{{--1000;--}}
{{--let nowTime = new Date();--}}
{{--let intDiff = parseInt(time - nowTime);//倒计时总秒数量--}}
{{--timer(intDiff);--}}
{{--});--}}

{{--window.setInterval(function () {--}}
{{--$.post("http://shop.sunwei93.cn/shopCar/judgePayStatus/11", function (res) {--}}
{{--if (res.code == 1) {--}}
{{--location.href = '/shopCar/successPay';--}}
{{--}--}}
{{--}, 'json');--}}
{{--}, 5000);--}}


